import { createRenderer } from '../../lib/min-vue.esm.js'
import { App } from './App.js'

const app = new PIXI.Application()
await app.init({ width: 640, height: 360 })
document.body.appendChild(app.canvas)

function createElement(type) {
  if (type === 'rect') {
    const rect = new PIXI.Graphics()
    rect.beginFill(0xff0000)
    rect.drawRect(0, 0, 100, 100)
    rect.endFill()

    return rect
  }
}

function patchProp(el, key, value) {
  el[key] = value
}

function insert(el, container) {
  container.addChild(el)
}

const renderer = createRenderer({
  createElement,
  patchProp,
  insert
})

renderer.createApp(App).mount(app.stage)
